﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ReportIterationControl.ascx.cs" Inherits="SimplePMT.Control.ReportIterationControl" %>
    <table width="100%" cellpadding=3>
        <tr>
            <td style="white-space:nowrap;color:#ffffff" bgcolor="#869AAE">Iteration Report: Tasks Due from <%= FromDate %> - <%= ToDate %></td>
        </tr>
        <tr>
            <td style="border:1px solid #6893cf;" bgcolor="#ffffff" valign=top>
                <div id="TaskView">
                <table width="100%" align=center>
                    <tr>
                        <td align=right valign=top><b>Tasks Due:</b></td>
                        <td><%= TasksDue %></td>
                    </tr>
                    <tr>
                        <td align=right><b>Tasks Open:</b></td>
                        <td><%= TasksOpen %></td>
                    </tr>
                    <tr>
                        <td align=right><b>Tasks Closed:</b></td>
                        <td><%= TasksClosed %></td>
                    </tr>
                    <tr>
                        <td align=right><b>Hours Estimated:</b></td>
                        <td><%= HoursEstiatedTotal %> (Tasks Due and completed)</td>
                    </tr>
                    <tr>
                        <td align=right><b>Hours Actual:</b></td>
                        <td><%= HoursActualTotal %> (Tasks Due and completed)</td>
                    </tr>
                    <tr>
                        <td colspan=2>
                            <table width=100% cellpadding=3 cellspacing=0 border=0>
                                <tr style="color:#ffffff" bgcolor="#869AAE">
                                    <td align=center><b>Task</b></td>
                                    <td align=center><b>Member</b></td>
                                    <td align=center><b>Assigned</b></td>
                                    <td align=center><b>Due</b></td>
                                    <td align=center><b>Complete</b></td>
                                </tr>
                                <% foreach (Task task in tasks)
                                   { %>
                                
                                <% TaskContainer container = new TaskContainer();
                                       TaskContainerItem[] containerItems = TaskContainerItem.FindAllByProperty("TaskID", task.ID);
                                       if (containerItems.Length > 0)
                                       {
                                           container = containerItems[0].TaskContainer;
                                       }
                                       string member = "N/A";
                                       if (!task.AssignedMemberID.Equals(0))
                                       {
                                           Member m = Member.Find(task.AssignedMemberID);
                                           member = m.FirstName + " " + m.LastName;
                                       }
                                       %>
                                <tr style="font-size:11px;" OnClick="location.href='TaskView.aspx?id=<%= task.ID %>&cid=<%= container.ID %>';" OnMouseOver="this.className='highlightRow';this.style.cursor='pointer';" OnMouseOut="this.className='';">
                                    <td width=65%><%= task.Title %> (<%= Common.GetRecursiveTaskTreePath(container) %>)</td>
                                    <td><%= member %></td>
                                    <td><% if (task.AssignedDateTime.HasValue)
                                           { %><%= task.AssignedDateTime.Value.ToShortDateString() %><% }
                                           else
                                           { %>N/A<% } %></td>
                                    
                                    <td><% if (task.DueDate.HasValue)
                                           { %><%= task.DueDate.Value.ToShortDateString() %><% }
                                           else
                                           { %>N/A<% } %></td>
                                    <td><% if (!task.ClosedDateTime.Equals(new DateTime(1900,1,1)))
                                           { %>Yes<% }
                                           else
                                           { %>No<% } %></td>
                                </tr>
                                <% } %>
                            </table>
                        </td>
                    </tr>
                </table>
                </div>
            </td>
        </tr>
    </table>